package com.gthncz;

import java.util.Arrays;
import java.util.Scanner;

public class MeituanDemo3 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] nodes = new int[n];

        for (int i=0; i<n; ++i) {
            nodes[i] = sc.nextInt();
        }

        // Arrays.sort(nodes);
        int cost = 0;
        for (int i=1; i<n; ++i) {
            cost += (n-1-i) * nodes[i];
        }

        System.out.printf("%d", cost);
    }

}
